<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>pvm_spawn</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab function</center>
    <div align="right">Last update : 13/07/2005</div>
    <p>
      <b>pvm_spawn</b> -  Starts new Scilab processes.  </p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[tids, numt] = pvm_spawn(task,  ntask, [nw], [where])  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>task : string, which is the file name of the scilab script (see exec) to be</b>
        </tt>started. The Scilab script must already reside on the host on which it is to be started.  The name must an absolute path.</li>
      <li>
        <tt>
          <b>ntask</b>
        </tt>: integer, specifying the number of copies of the  scilab script to start.</li>
      <li>
        <tt>
          <b>win</b>
        </tt>: string (optional). If win is  equal to ``nw'' the Scilab process will be spawned in background with out any window coming up.</li>
      <li>
        <tt>
          <b>where</b>
        </tt>: string (optional), can be a host name such as ``tequila.ens-lyon.fr'' or a PVM architecture class such as ``SUN4''.</li>
      <li>
        <tt>
          <b>numt</b>
        </tt>: integer, the actual number of tasks started. Values less than zero indicate a system error.</li>
      <li>
        <tt>
          <b>tids</b>
        </tt>row of integers, array of the tids of the PVM processes started
     by this pvm_spawn call.</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>pvm_spawn</b>
      </tt> 
    starts <tt>
        <b>ntask</b>
      </tt> 
    copies of the scilab script <tt>
        <b>task</b>
      </tt>.</p>
    <p>
    On systems that support environment,
    <tt>
        <b>pvm_spawn</b>
      </tt> passes selected variables from parent
    environment to children tasks. 
    If set, the envar <tt>
        <b>PVM_EXPORT</b>
      </tt> is passed.
    If <tt>
        <b>PVM_EXPORT</b>
      </tt> contains other names (separated by
    ':') they will 
    be passed too. This is useful for e.g.:</p>
    <pre>


 setenv DISPLAY myworkstation:0.0
 setenv MYSTERYVAR 13
 setenv PVM_EXPORT DISPLAY:MYSTERYVAR
   
    </pre>
    <p>
    The hosts on which
    the PVM processes are started are determined by 
    the <tt>
        <b>where</b>
      </tt> arguments. On return the array
    <tt>
        <b>tids</b>
      </tt>  contains the PVM task identifiers for each
    process started.</p>
    <p>
    If <tt>
        <b>pvm_spawn</b>
      </tt> starts one or more tasks, 
    <tt>
        <b>numt</b>
      </tt> will be the actual number of tasks started. 
    If a system error occurs then <tt>
        <b>numt</b>
      </tt> will be &lt; 0.</p>
    <p>
    If <tt>
        <b>numt</b>
      </tt>  is less than <tt>
        <b>ntask</b>
      </tt> 
    then some executables have failed to start and the user should check the last
    locations in the <tt>
        <b>tids</b>
      </tt> array which will contain error codes
    (see below for meaning). The first <tt>
        <b>numt</b>
      </tt> 
    tids in the array are always valid.</p>
    <p>
    When the argument <tt>
        <b>where</b>
      </tt>
    is omitted an heuristic (round-robin assignment) is used to distribute the
    <tt>
        <b>ntask</b>
      </tt> processes across the virtual machine.</p>
    <p>
    In the special case where a multiprocessor is specified by
    <tt>
        <b>where</b>
      </tt>
      <tt>
        <b>pvm_spawn</b>
      </tt> will start all
    copies on this single machine using the vendor's underlying routines.</p>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="pvm.htm">
        <tt>
          <b>pvm</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="pvm_spawn_independent.htm">
        <tt>
          <b>pvm_spawn_independent</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
